import request from '@/axios'

//获取列表数据
export const getListApi = (params?: any) => {
  return request.get({ url: '/admin/returnorder', params })
}

// 获取退款单列表（资金退款）
export const getRefundOrderListApi = (params?: any) => {
  return request.get({ url: '/admin/returnorder/refund_order', params })
}

// 获取退货单列表
export const getReturnOrderListApi = (params?: any) => {
  return request.get({ url: '/admin/returnorder/return_order', params })
}
//获取枚举数据
export const getEnumApi = (params?: any) => {
  return request.get({ url: '/admin/returnorder/resource', params })
}

export const getOrderListApi = (params?: any) => {
  return request.get({ url: '/admin/returnorder/order', params })
}

export const createDataApi = (data) => {
  return request.post({ url: '/admin/returnorder', data })
}

export const getDetailApi = (id: string | number, params?: any) => {
  return request.get({ url: `/admin/returnorder/${id}`, params })
}

// 获取退货单详情（用于入库）
export const getReturnOrderDetailApi = (id: string | number) => {
  return request.get({ url: `/admin/returnorder/${id}` })
}
export const editDataApi = (data) => {
  return request.put({ url: `/admin/returnorder/${data.id}`, data })
}

export const uploadFileApi = (data) => {
  return request.post({ url: `/admin/returnorder/payment`, data })
}

export const examineDataApi = (id: string | number, data?: Record<string, any>) => {
  return request.put({ url: `/admin/returnorder/review/${id}`, data })
}
//获取回显数据

//批量取消
export const cancelDataApi = (data) => {
  return request.put({ url: `/admin/returnorder/cancel`, data })
}

//单个取消
export const cancelSingleDataApi = (id: string | number) => {
  return request.put({ url: `/admin/returnorder/cancel/${id}` })
}

//获取订单支付信息
export const getOrderPaymentListApi = (id: string | number) => {
  return request.get({ url: `/admin/orderPayment/order_related_payment_list/${id}` })
}

//获取支付信息枚举
export const getOrderPaymentResourceApi = () => {
  return request.get({ url: '/admin/orderPayment/resource' })
}

//获取仓库数据
export const getWarehouseResourceApi = () => {
  return request.get({ url: '/admin/inventory/resource?field=warehouse_parent_tree' })
}

//提交入库
export const submitStockApi = (data: any) => {
  return request.post({ url: '/admin/returnorder/return_order/stock', data })
}

// 获取操作记录
export const orderReturnOperateRecordsApi = (params: any) => {
  return request.get({ url: '/admin/returnorder/operateRecords', params })
}
